// Excess Property Checks
interface SquareConfig {
  color?: string;
  width?: number;
  [propName: string]: any; // 额外属性
}


function createSquares(config: SquareConfig): {color: string; area: number} {
  let newSquare = {color: "white", area: 100};
  if (config.color) {
      newSquare.color = config.color;
       // Error: Property 'clor' does not exist on type 'SquareConfig'
       newSquare.color = config.clor;
  }
  if (config.width) {
      newSquare.area = config.width * config.width;
  }
  return newSquare;
}


let squareOptions = { colour: "red", width: 100 };
let mySquares = createSquares(squareOptions);


